<?php

/**
 * ECSHOP 文章内容
 * ============================================================================
 * * 版权所有 2005-2012 上海商派网络科技有限公司，并保留所有权利。
 * 网站地址: http://www.ecshop.com；
 * ----------------------------------------------------------------------------
 * 这不是一个自由软件！您只能在不用于商业目的的前提下对程序代码进行修改和
 * 使用；不允许对程序代码以任何形式任何目的的再发布。
 * ============================================================================
 * $Author: liubo $
 * $Id: article.php 17217 2011-01-19 06:29:08Z liubo $
*/

define('IN_ECS', true);

require(dirname(__FILE__) . '/includes/init.php');

if ((DEBUG_MODE & 2) != 2)
{
    $smarty->caching = true;
}

/*------------------------------------------------------ */
//-- INPUT
/*------------------------------------------------------ */

$act = isset($_REQUEST['act'])?$_REQUEST['act']:'article';

/*------------------------------------------------------ */
//-- PROCESSOR
/*------------------------------------------------------ */

$cache_id = sprintf('%X', crc32($_REQUEST['act'] . '-' . $_CFG['lang']));

if (!$smarty->is_cached('action.dwt', $cache_id))
{
    if (empty($act))
    {
        ecs_header("Location: ./\n");
        exit;
    }
    assign_template();

    $smarty->assign('helps',            get_shop_help()); // 网店帮助
    $smarty->assign('username',         $_SESSION['user_name']);
    $smarty->assign('email',            $_SESSION['email']);

    $smarty->assign('keywords',     htmlspecialchars($article['keywords']));
    $smarty->assign('description', htmlspecialchars($article['description']));

    $position = assign_ur_here($article['cat_id'], $article['title']);
    $smarty->assign('page_title',   $position['title']);    // 页面标题
    $smarty->assign('ur_here',      $position['ur_here']);  // 当前位置
    $smarty->assign('comment_type', 1);
   
}
if(isset($act))
{
    switch ($act) {
        case 'promise':
            $smarty->display('promise.dwt', $cache_id);
            break;
        case 'market':
            $smarty->display('market.dwt', $cache_id);
            break;
        case 'booking':
            $smarty->display('booking.dwt', $cache_id);
            break;
        case 'integral':
            $smarty->display('integral.dwt', $cache_id);
            break;
        case 'news':
            $smarty->assign('special_list',special_list(1,4));
            $smarty->assign('Industry_head_news',get_news(10,1,1,2));
            $smarty->assign('Industry_news',get_news(10,1,7,1));
            $smarty->assign('health_head_news',get_news(11,1,1,2));
            $smarty->assign('health_news',get_news(11,1,10,1));
            $smarty->display('news.dwt', $cache_id);
            break;
        case 'special':
            $smarty->assign('article_categories',   article_categories_tree(11)); //文章分类树
            /* 获得当前页码 */
            $page   = !empty($_REQUEST['page'])  && intval($_REQUEST['page'])  > 0 ? intval($_REQUEST['page'])  : 1;
            $size   = 10; //分页大小
            $count  = get_special_count(); //获取所有专题条数
            $pages  = ($count > 0) ? ceil($count / $size) : 1;
            if ($page > $pages)
            {
                $page = $pages;
            }
            assign_pager('special', 0, $count, $size, '', '', $page, '');
            $smarty->assign('special_list',special_list($page,$size));
            $smarty->display('special.dwt', $cache_id);
            break;
        default:
            $smarty->display('article.dwt', $cache_id);
            break;
    }
}


?>